class Per {
    //class内部只能写方法和静态属性
    static sex = "男"

    //每个class内部都有一个constructor构造器,默认会定义空参构造
    constructor(name,age){
        this.name=name
        this.age=age
    }
    //实例方法
    say(){
        console.log(this.age,this.name)
    }

    static sayHello(){
        console.log("父类静态方法");
    }
}
let person = new Per("黄鑫",20)
//静态属性和方法挂载到构造器上
console.log(person.constructor.sex);
person.constructor.sayHello();


class Chinese extends Per{
    constructor(name,age,addr){
        super(name,age)
        this.addr=addr
    }

    say(){
        console.log(this.name,this.age,this.addr)
    }
}

let chinese = new Chinese("黄鑫",20,"广东")
console.log(chinese);
chinese.say()
chinese.constructor.sayHello()


